<?php

/**
 * Valor form base class.
 *
 * @method Valor getObject() Returns the current form's model object
 *
 * @package    SistemaWebUnlSenescyt
 * @subpackage form
 * @author     JFernando
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseValorForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_va' => new sfWidgetFormInputHidden(),
      'id_dg' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('descripciongeneral'), 'add_empty' => true)),
      'id_ac' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('actividad'), 'add_empty' => false)),
      'id_fo' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('fondo'), 'add_empty' => true)),
      'mes'   => new sfWidgetFormInputText(),
      'anio'  => new sfWidgetFormInputText(),
      'val'   => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id_va' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id_va')), 'empty_value' => $this->getObject()->get('id_va'), 'required' => false)),
      'id_dg' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('descripciongeneral'), 'required' => false)),
      'id_ac' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('actividad'))),
      'id_fo' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('fondo'), 'required' => false)),
      'mes'   => new sfValidatorInteger(array('required' => false)),
      'anio'  => new sfValidatorInteger(array('required' => false)),
      'val'   => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('valor[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Valor';
  }

}
